//
//  MainTabBarController.m
//  sinaOC
//
//  Created by 黄龙飞 on 15/12/15.
//  Copyright © 2015年 黄龙飞. All rights reserved.
//

#import "MainTabBarController.h"
#import "HomeTableViewController.h"
#import "MessageTableViewController.h"
#import "DiscoverTableViewController.h"
#import "ProfileTableViewController.h"

@interface MainTabBarController ()
@property (nonatomic,strong) UIButton *composedButton;
@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildViewControllers];
}

-(UIButton *)composedButton{
    UIButton *composeBtn = [[UIButton alloc]init];
    return  composeBtn;
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
}

-(void)addChildViewControllers{
    [self addSubControllerWithViewController:[HomeTableViewController new] image:@"tabbar_home" title:@"首页"];
    [self addSubControllerWithViewController:[MessageTableViewController new] image:@"tabbar_message_center" title:@"消息"];
    [self addSubControllerWithViewController:[DiscoverTableViewController new] image:@"tabbar_discover" title:@"发现"];
    [self addSubControllerWithViewController:[ProfileTableViewController new] image:@"tabbar_profile" title:@"我"];
}

-(void)addSubControllerWithViewController:(UIViewController *)vc image:(NSString *)img title:(NSString *)title{
    vc.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:img];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
    [self addChildViewController:nav];
}


@end
